import java.util.*;
import java.util.regex.*;
class UserInput {
	private int[] lastDate;
	private Scanner in = new Scanner(System.in);
	int[] getDate(String prompt) {
		String date;
		int day;
		String month;
		int year;
		int[] result = new int[3];
		Arrays.fill(result, 0);
		Pattern pDate = Pattern.compile("^(\\d{1,2})\\s([a-z]*)\\s(\\d{4,})$");
		System.out.println(prompt);
		do {
			date = in.nextLine().trim().toLowerCase();
			Matcher mDate = pDate.matcher(date);
			mDate.find();
			day = Integer.parseInt(mDate.group(1));
			month = mDate.group(2);
			year = Integer.parseInt(mDate.group(3));
		} while (!checkDate(day, month, year));
		result[0] = day;
		result[1] = Year.getMonthNumber(month);
		result[2] = year;
		return result;
	} 
	
	static private boolean checkDate(int day, String month, int year) {
		boolean result = true;
		boolean isLeap = (year % 4 == 0 && year % 400 == 0);
		int monthLength = Year.getMonthLength(month, isLeap);
		if (day > monthLength || day < 1) {
			result = false;
		}
		
		if (year < 1583) {
			result = false;
		}
		return result;
	}
	
}